//
//  KnowledgeDetailVC.m
//  ProjectA
//
//  Created by lioccord on 15-3-7.
//  Copyright (c) 2015年 dlios. All rights reserved.
//

#import "KnowledgeDetailVC.h"

@interface KnowledgeDetailVC ()

@end

@implementation KnowledgeDetailVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor grayColor];
    // Do any additional setup after loading the view.
    
    
    NSLog(@"detail ID %ld", self.identify);
    

    //创建 webview
    UIWebView *webview = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height - 50)];
    
    webview.delegate = self;
    webview.scalesPageToFit = YES;
    
    [self.view addSubview:webview];
    
    //创建 request
    NSString *url_string = [NSString stringWithFormat:@"http://ibaby.ipadown.com/api/food/food.tips.detail.php?id=%ld", self.identify];
    
    NSURL *url=[NSURL URLWithString:url_string];//创建URL
    
    NSMutableURLRequest *request=[[NSMutableURLRequest alloc]initWithURL:url];//通过URL创建网络请求
    
    [webview loadRequest:request];  //通过 request 请求
    
    
    //加载动画
    self.indicator = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(0, 0,162,162)];
    self.indicator.center = self.view.center;
    [self.indicator setActivityIndicatorViewStyle:(UIActivityIndicatorViewStyleGray)];
    [self.view addSubview:self.indicator];
    
    //分享按钮
   
} //did load

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(void)webViewDidStartLoad:(UIWebView *)webView{
    
    [self.indicator startAnimating];
    
}//webview 开始加载


-(void)webViewDidFinishLoad:(UIWebView *)webView{
    
    [self.indicator stopAnimating];
    
}//webview 加载结束


-(void)shareButtonAct:(UIBarButtonItem *)sender{
    NSLog(@"share   ");
    
}//分享按钮
@end












